#include <bits/stdc++.h>
using namespace std;
struct D {
	int l, r;
} a[100005];
int n, cnt, la, x, lax, m, k;
int main() {
	freopen("fruit.in", "r", stdin);
	freopen("fruit.out", "w", stdout);
	cin >> n >> x;
	la = x;
	lax = 1;
	for(int i = 2; i <= n; i++) {
		scanf("%d", &x);
		if(x != la) a[++cnt].l = lax, a[cnt].r = i - 1, lax = i, la = x;
	} 
	a[++cnt].l = lax, a[cnt].r = n;
	for(int i = 1; i <= cnt; i++) 
		m = max(m, a[i].r - a[i].l + 1);
	for(int k = 0; k < cnt; k++) {
		for(int i = 1; i <= cnt; i++) 
			if(a[i].l + k <= a[i].r) printf("%d ", a[i].l + k);
		printf("\n");
	} 
	return 0;
} 
